

%------------------------------------------------------------------------

% 
function [adjVerticesList] = createVertexAdjacencyList(topologyInfo, numberOfVertices)

numberOfFaces = size(topologyInfo, 1);
kMaxNumberOfAdjVertices = get_num_adj_vertices();
adjVerticesList = zeros(numberOfVertices, kMaxNumberOfAdjVertices);

return;

for vert_id = 1:numberOfVertices
    adjVerticesList(vert_id, :) = adj_vert(vert_id);
end % FOR

for iFace = 1:numberOfFaces
    v1 = topologyInfo(iFace,1);
    v2 = topologyInfo(iFace,2);
    v3 = topologyInfo(iFace,3);
    % 1
    adjVerticesList = addAdjVertex(v2,v1,adjVerticesList,kMaxNumberOfAdjVertices);
    adjVerticesList = addAdjVertex(v3,v1,adjVerticesList,kMaxNumberOfAdjVertices);
    % 2
    adjVerticesList = addAdjVertex(v1,v2,adjVerticesList,kMaxNumberOfAdjVertices);
    adjVerticesList = addAdjVertex(v3,v2,adjVerticesList,kMaxNumberOfAdjVertices);
    % 3
    adjVerticesList = addAdjVertex(v1,v3,adjVerticesList,kMaxNumberOfAdjVertices);
    adjVerticesList = addAdjVertex(v2,v3,adjVerticesList,kMaxNumberOfAdjVertices);
end % FOR

end % FUNCTION createVertexAdjacencyList

function [adj_v] = adj_vert(topologyInfo, vi)
end % FUNCTION adj_vert

%-----------------------------------------------------------------------
function [resultAdjVerticesList] = addAdjVertex(newVertex, forVertex, adjVerticesList, kMaxNumberOfAdjVertices)
resultAdjVerticesList = adjVerticesList;
index = 1;
while ( index <= kMaxNumberOfAdjVertices )
            if (resultAdjVerticesList(forVertex, index) == 0)
                resultAdjVerticesList(forVertex, index) = newVertex;
                index = kMaxNumberOfAdjVertices + 1;
            elseif (resultAdjVerticesList(forVertex, index) == newVertex)
                index = kMaxNumberOfAdjVertices + 1;
            else
                index = index + 1; 
            end
        end
end % fucntion addAdjVertex
%-----------------------------------------------------------------------

function [triangle_id] = search_triangle_with_verts()
end % function search_triangle_with_verts